package com.base.service.impl;

import com.base.mapper.voipmapper.TxSbdIpfMapper;
import com.base.po.voip.TxSbdIpf;
import com.base.po.voip.TxSbdIpfExample;
import com.base.service.TxSbdIpfService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("TxSbdIpfService")
public class TxSbdIpfServiceImpl implements TxSbdIpfService {
    @Autowired
    private TxSbdIpfMapper txSbdIpfMapper;

    @Override
    public int countByExample(TxSbdIpfExample example) {
        return txSbdIpfMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(TxSbdIpfExample example) {
        return txSbdIpfMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return txSbdIpfMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TxSbdIpf record) {
        return txSbdIpfMapper.insert(record);
    }

    @Override
    public int insertSelective(TxSbdIpf record) {
        return txSbdIpfMapper.insertSelective(record);
    }

    @Override
    public List<TxSbdIpf> selectByExample(TxSbdIpfExample example) {
        return txSbdIpfMapper.selectByExample(example);
    }

    @Override
    public TxSbdIpf selectByPrimaryKey(Integer id) {
        return txSbdIpfMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByExampleSelective(TxSbdIpf record, TxSbdIpfExample example) {
        return txSbdIpfMapper.updateByExampleSelective(record, example);
    }

    @Override
    public int updateByExample(TxSbdIpf record, TxSbdIpfExample example) {
        return txSbdIpfMapper.updateByExample(record, example);
    }

    @Override
    public int updateByPrimaryKeySelective(TxSbdIpf record) {
        return txSbdIpfMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TxSbdIpf record) {
        return txSbdIpfMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<TxSbdIpf> selectByUserIdAndStatus(String userId, Integer type) {
      List<TxSbdIpf>  txSbdIpfs=txSbdIpfMapper.selectByUserId(userId,type,0);
        return txSbdIpfs;
    }

    @Override
    public List<TxSbdIpf> searchBy(String subId, Integer type, Integer status,String beginTime, String endTime,Integer pageNo) {
        if (status==null || status.equals(100)) status=null;
        if (type==null || type.equals(100)) type=null;
        Page<TxSbdIpf> page = PageHelper.startPage(pageNo, 10).setOrderBy("tx_time desc");
        List<TxSbdIpf> data = txSbdIpfMapper.selectByAll(subId,type,status,beginTime,endTime);
        return data;
    }

    @Override
    public Integer countBy(String subId, Integer type, Integer status, String beginTime, String endTime, Integer changeType, Integer statustx) {
        if (status==null || status.equals(100)) status=null;
        if (type==null || type.equals(100)) type=null;
        return txSbdIpfMapper.countByAll(subId,type,status,beginTime,endTime,changeType,statustx);
    }


    @Override
    public List<TxSbdIpf> searchByAll(String subId, Integer type, Integer status,String beginTime, String endTime,Integer pageNo) {
        if (status==null || status.equals(100)) status=null;
        if (type==null || type.equals(100)) type=null;
        Page<TxSbdIpf> page = PageHelper.startPage(pageNo, 10000).setOrderBy("tx_time desc");
        List<TxSbdIpf> data = txSbdIpfMapper.selectByAll(subId,type,status,beginTime,endTime);
        return data;
    }
}
